{extend name="public/base"}

{block name="title"}就行天下-店铺信息{/block}

{block name="style"}
<link rel="stylesheet" href="__STATIC__/home/css/index.css" />
{/block}

{block name="main"}
<div class="pageControl productList bg-f7">
    <div class="main-top"></div>
    <div class="msui_nav msui_navTop noBorder">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">添加订单商品</h1>
        <a href="" class="msui_navTop-right msui_navTop-cnav"><i class="micon-cnav"></i></a>
    </div>
    <div class="msui_menu">
        <div class="msui_menu-mask">
            <ul class="msui_menu-bd js-menu">
                {volist name="data" id="vo"}
                <li class="msui_menu-li" data-tab="{$i - 1}">
                    <a class="msui_menu-list fs08 cl-6666" data-category-id="{$vo.id}" href="#hash{$i - 1}_" data-hash="#hash{$i - 1}_">{$vo.name}</a>
                </li>
                {/volist}
                <!-- 用于动画的层 -->
                <div id="line" class="weui-baseline"></div>
            </ul>
        </div>
    </div>
    <div class="weui-search-bar" id="searchBar">
        <form class="weui-search-bar__form">
            <div class="weui-search-bar__box">
                <i class="weui-icon-search"></i>
                <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
                <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
            </div>
            <label class="weui-search-bar__label addSearch " id="searchText">
                <span>搜索商品、品牌</span>
                <i class="weui-icon-search"></i>
            </label>
        </form>
        <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
    </div>
    <p class="cl-ffa fs065">提示：添加到订单的产品，推送之前可以在订单详情页面删除</p>
    <div class="mtab_list mtop05" style="position: relative;">

        <div class="js-list active">

        </div>
    </div>
</div>
{/block}

{block name="javascript"}
<script>
    SCOPE.obj = {
        action : 'shop_product',
        is_more : true,
        page : 1,
        url : '{:url("shop_order_add_product")}',
        hash : '0',
        container : '.js-list',
        data : {
            shop_id : '{$id}'
        }
    };

    $(function () {
        $(document).on('click', '.indent-btn-add', function () {
            var _this = $(this);
            $.confirm('确认添加产品到该订单', function () {
                $.showLoading();
                $.ajax({
                    type : 'POST',
                    url : '{:url("save_shop_order_product")}',
                    data : {
                        id : _this.data('id'),
                        shop_id : _this.data('shop-id'),
                        order_id : '{$order_id}'
                    },
                    dataType : 'json',
                    success : function (msg) {
                        $.hideLoading();
                        console.log(msg);
                        if (msg.code == 200) {
                            $.toptip('添加成功！', 'success');
                        } else {
                            $.toptip(msg.msg);
                        }
                    }
                });
            });
        });
    });
</script>
{/block}